package org.xi.behavioral.mediator.impl;

import org.xi.behavioral.mediator.api.ChatMediator;
import org.xi.behavioral.mediator.api.User;

/**
 * 具体参与者
 */
public class UserImpl extends User {

    public UserImpl(ChatMediator mediator, String name) {
        super(mediator, name);
    }

    @Override
    public void send(String message) {
        System.out.println(this.name + " 发送消息: " + message);
        mediator.sendMessage(message, this);
    }

    @Override
    public void receive(String message) {
        System.out.println(this.name + " 接收到消息: " + message);
    }
}
